package mspbots.teams.data.core.planners;

import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Mono;

/**
 * mspbots.data.sync.autotask.badmessage.AtBadMsgRepository
 *
 * @author <a href="https://github.com/vnobo">Alex bob</a>
 * @date Created by 2020/7/21
 */
@Repository
public interface TasksRepository extends R2dbcRepository<Tasks, Long> {

    /**
     * find entity other id and tenant id
     *
     * @param tenantId tenant id
     * @param groupId  group Id
     * @param planId   planners Id
     * @param otherId  other Id
     * @return Tasks entity
     */
    @Query("select * from teams_planners_tasks where tenant_id = :tenantId and group_Id=:groupId and plan_Id=:planId" +
            " and other_Id =:otherId")
    Mono<Tasks> findByIds(Long tenantId, String groupId, String planId, String otherId);
}
